<?php

namespace App\Admin\Repositories;

use App\Models\Option as Model;
use Dcat\Admin\Repositories\EloquentRepository;

class Option extends EloquentRepository
{
    /**
     * Model.
     *
     * @var string
     */
    protected $eloquentClass = Model::class;

    public function get_types($key = '')
    {
        if ($key == '') {
            return $this->eloquentClass::$type_text;
        }
        return $this->eloquentClass::$type_text[$key];
    }

    public function get_province()
    {
        return $this->eloquentClass::where('type', 'province')->get()->pluck('option', 'option')->toArray();
    }

    public function get_college_tab()
    {
        return $this->eloquentClass::where('type', 'college_tab')->get()->pluck('option', 'id')->toArray();
    }
}
